package stmo.树.二叉树;

import stmo.队列.Queue;

/**
 *  二叉树遍历测试类
 */


public class BinaryTreeErgodicTest {

    public static void main(String[] args) {

        BinaryTree<String,String> tree = new BinaryTree<>();
        tree.put("E", "5");
        tree.put("B", "2");
        tree.put("G", "7");
        tree.put("A", "1");
        tree.put("D", "4");
        tree.put("F", "6");
        tree.put("H", "8");
        tree.put("C", "3");


        /*
        //测试前序遍历
        Queue<String> queue = tree.preErgodic();

        for (String s : queue) {
            String value = tree.get(s);
            System.out.println(s+" "+value);
        }
        */


        //测试中序遍历
        Queue<String> queue = tree.midErgodic();

        for (String s : queue) {
            String value = tree.get(s);
            System.out.println(s+" "+value);
        }



        /*
        //测试后序遍历
        Queue<String> queue = tree.afterErgodic();

        for (String s : queue) {
            String value = tree.get(s);
            System.out.println(s+" "+value);
        }
        */

        /*
        //使用层序遍历
        Queue<String> queue = tree.layerErgodic();
        for (String s : queue) {
            String value = tree.get(s);
            System.out.println(s+" "+value);
        }
        */
    }
}
